package com.rongshu.view.home.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.rongshu.R;
import com.rongshu.view.home.entity.ReplyInfo;
import com.rongshu.view.home.widget.CommentLiearLayout;

import java.util.List;

public class ReplyListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

    private Context mContext = null;

    private List<ReplyInfo> replyInfoList = null;

    public ReplyListAdapter(Context context) {
        this.mContext = context;
    }

    public void setReplyInfoList(List<ReplyInfo> list) {
        this.replyInfoList = list;
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.adapter_reply_list_item_view, parent, false);
        return new ReplyListViewHolder(view);
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        ReplyListViewHolder viewHolder = (ReplyListViewHolder) holder;
        viewHolder.comment_layout.setRepleyList(replyInfoList);
    }

    @Override
    public int getItemCount() {
        return 5;
    }

    public static class ReplyListViewHolder extends RecyclerView.ViewHolder {

        private CommentLiearLayout comment_layout;

        public ReplyListViewHolder(View itemView) {
            super(itemView);
            comment_layout = itemView.findViewById(R.id.comment_layout);
        }
    }
}
